<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>组件</title>
	<script src="./lib/vue-2.4.0.js"></script>
</head>
<body>
	<div id="app">
     <mycoml></mycoml>
     </hr>
     <mycoml></mycoml>
     </hr>
     <mycoml></mycoml>
  </div>

  <template id="coml1"> 
      <div>
         <input type="button" value="+1" @click="change">
         <h3>{{msg}}</h3>
      </div>
  </template>

	<script>
      //创建一个全局组件
      Vue.component('mycoml',{
         template:'#coml1',
         data:function(){
            return {msg:0}
         },
         methods:{
             change(){
                this.msg+=1
             }
         }
      })

      var vm=new Vue({
         el:'#app',
         data:{}
      });
	</script>
</body>
</html>